<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="一些算法, 博客">
    <meta name="description" content="个人学习储备知识与经验的秘密基地">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Global site tag (gtag.js) - Google Analytics -->

<script async src="https://www.googletagmanager.com/gtag/js?id=G-KDXT8Y4CLW"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag() {
        dataLayer.push(arguments);
    }

    gtag('js', new Date());
    gtag('config', 'G-KDXT8Y4CLW');
</script>


    <title>一些算法 | 不二博客</title>
    <link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/favicon.png">

    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/css/matery.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/css/my.css">

    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/jquery/jquery.min.js"></script>

<meta name="generator" content="Hexo 6.3.0">
<style>.github-emoji { position: relative; display: inline-block; width: 1.2em; min-height: 1.2em; overflow: hidden; vertical-align: top; color: transparent; }  .github-emoji > span { position: relative; z-index: 10; }  .github-emoji img, .github-emoji .fancybox { margin: 0 !important; padding: 0 !important; border: none !important; outline: none !important; text-decoration: none !important; user-select: none !important; cursor: auto !important; }  .github-emoji img { height: 1.2em !important; width: 1.2em !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; user-select: none !important; cursor: auto !important; } .github-emoji-fallback { color: inherit; } .github-emoji-fallback img { opacity: 0 !important; }</style>
<link rel="alternate" href="/atom.xml" title="不二博客" type="application/atom+xml">
</head>




<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">不二博客</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">不二博客</div>
        <div class="logo-desc">
            
            个人学习储备知识与经验的秘密基地
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://github.com/weiyouwozuiku" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>Fork Me
            </a>
        </li>
        
    </ul>
</div>


        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://github.com/weiyouwozuiku" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="Fork Me" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    
<script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/cryptojs/crypto-js.min.js"></script>
<script>
    (function() {
        let pwd = '';
        if (pwd && pwd.length > 0) {
            if (pwd !== CryptoJS.SHA256(prompt('请输入访问本文章的密码')).toString(CryptoJS.enc.Hex)) {
                alert('密码错误，将返回主页！');
                location.href = '/';
            }
        }
    })();
</script>




<div class="bg-cover pd-header post-cover" style="background-image: url('https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@src/source/_posts/PageImg/算法/algorithm.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">一些算法</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        padding: 35px 0 15px 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        padding-bottom: 30px;
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/%E9%A9%AC%E5%B0%94%E5%8F%AF%E5%A4%AB/">
                                <span class="chip bg-color">马尔可夫</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/%E7%AE%97%E6%B3%95/" class="post-category">
                                算法
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2020-05-14
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2022-01-14
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    3.6k
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-clock fa-fw"></i>阅读时长:&nbsp;&nbsp;
                    12 分
                </div>
                

                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>
        </div>
        <hr class="clearfix">

        
        <!-- 是否加载使用自带的 prismjs. -->
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/prism/prism.css">
        

        
        <!-- 代码块折行 -->
        <style type="text/css">
            code[class*="language-"], pre[class*="language-"] { white-space: pre-wrap !important; }
        </style>
        

        <div class="card-content article-card-content">
            <div id="articleContent">
                <h2 id="马尔可夫">马尔可夫<a class="anchor" href="#马尔可夫">¶</a></h2>
<p>20世纪初,马尔可夫研究自然界有一类事物变化的过程仅与失误的近期状态有关,与事物过去的状态无关.即马尔可夫性.</p>
<p>一个马尔可夫过程是状态间的转移仅依赖前n个状态的过程.这个过程被称为n阶马尔可夫模型,其中n是影响下一个状态的(前)n个状态.</p>
<p>马尔可夫假设:假设模型的当前状态仅仅依赖前面的几个状态.</p>
<h3 id="相关名词">相关名词<a class="anchor" href="#相关名词">¶</a></h3>
<ul>
<li>随机过程的本质就是对一系列随机变量的整体描述.</li>
<li>马尔可夫矩阵的性质,其中每个值大于等于0,且每行或者每列和为1(这取决于是左乘还是右乘).</li>
<li>马尔可夫的时齐性:从状态i转化到状态j的转义概率<img src="https://math.now.sh?inline=p_%7Bij%7D%28m%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">仅仅依赖于时间的长短,与其他(比如起始状态等)均无关.</li>
</ul>
<h3 id="收敛的必要条件">收敛的必要条件<a class="anchor" href="#收敛的必要条件">¶</a></h3>
<ul>
<li>可能的状态数是有限的</li>
<li>状态间的转移概率需要固定不变</li>
<li>从任意状态能够转变到任意状态</li>
<li>不能是简单的循环</li>
</ul>
<h3 id="区别">区别<a class="anchor" href="#区别">¶</a></h3>
<p>T表示时间空间,E表示状态空间.</p>
<ul>
<li>T连续,E连续-&gt;连续Markov过程</li>
<li>T连续,E离散-&gt;离散Markov过程</li>
<li>T离散,E连续-&gt;Markov序列</li>
<li>T离散,E离散-&gt;Markov链</li>
</ul>
<h3 id="转移概率矩阵">转移概率矩阵<a class="anchor" href="#转移概率矩阵">¶</a></h3>
<p><img src="https://math.now.sh?inline=P%28m%29%3D(p_%7Bij%7D(m))" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">为马尔可夫链的m步转移矩阵.</p>
<p>马尔可夫预测的核心在于转移概率矩阵的确定,获取方法可以是理论分析亦或实际统计结果给出的,甚至是猜测的.</p>
<h4 id="性质">性质<a class="anchor" href="#性质">¶</a></h4>
<ol>
<li><img src="https://math.now.sh?inline=0%5Cle%20p_%7Bij%7D%28m%29%5Cle1" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">:概率在0~1之间.</li>
<li>对于任意的<img src="https://math.now.sh?inline=i%5Cin%20E" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,<img src="https://math.now.sh?inline=%5Csum_%7Bj%5Cin%20E%7Dp_%7Bij%7D%28m%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">:概率之和为1.</li>
<li>对于任意的<img src="https://math.now.sh?inline=i%2Cj%5Cin%20E" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,<img src="https://math.now.sh?inline=p_%7Bij%7D%280%29%3D%5Cbegin%7Bcases%7D%5Ctext%7B1%2Ci%3Dj%7D%5C%5C%200%2Ci%5Cneq%20j%5Cend%7Bcases%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">:不发生转移的概率.</li>
</ol>
<h3 id="柯尔莫格洛夫-切普曼方程-k-c方程">柯尔莫格洛夫-切普曼方程(k-c方程)<a class="anchor" href="#柯尔莫格洛夫-切普曼方程-k-c方程">¶</a></h3>
<p>对于任意的<img src="https://math.now.sh?inline=m%2Cn%5Cge%200" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,有<img src="https://math.now.sh?inline=%5Cbegin%7Bcases%7Dp_%7Bij%7D%28n%2Bm%29%3D%5Csum_%7Bk%5Cin%20E%7Dp_%7Bik%7D(n)p_%7Bkj%7D(m)%5C%5C%20P(n%2Bm)%3D(P(1))%5E%7Bn%2Bm%7D%5Cend%7Bcases%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></p>
<h3 id="马尔可夫预测">马尔可夫预测<a class="anchor" href="#马尔可夫预测">¶</a></h3>
<ol>
<li>对于一个马尔可夫链,其一步转移概率矩阵为P.</li>
<li>初始状态(初始分布)<img src="https://math.now.sh?inline=%5Cpi%20_j%280%29%3DP%5C%7B%5Cxi_0%3Dj%5C%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,反映了马尔可夫链在初始时候的对于各个状态的概率分布情况,可以搁在一起写个向量<img src="https://math.now.sh?inline=%5Cpi%280%29%3D(%5Cpi_1(0)%2C%5Cpi_2(0)%2C...)" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.</li>
<li>同样有<img src="https://math.now.sh?inline=%5Cpi_j%28n%29%3DP%5C%7B%5Cxi_n%3Dj%5C%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,表示经过n步转移后,马尔可夫链对于各个状态的概率分布情况.同样的,把它们搁在一起写成一个向量:<img src="https://math.now.sh?inline=%5Cpi%28n%29%3D(%5Cpi_1(n)%2C%5Cpi_2(n)%2C...)" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></li>
<li>预测方法:<img src="https://math.now.sh?inline=%5Cpi%28n%29%3D%5Cpi(0)P%5En" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></li>
<li><img src="https://math.now.sh?inline=%28%5Cpi_1(n%29%2C%5Cpi_2(n)%2C...)" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">收敛到一个固定的向量,称之为马尔可夫链或转移矩阵P的不变分布(<strong>不是所有的马尔可夫链都有不变分布</strong>).当马尔可夫链有不变分布时,称之为马尔科夫链具有遍历性.</li>
</ol>
<h3 id="可观测马尔可夫模型">可观测马尔可夫模型<a class="anchor" href="#可观测马尔可夫模型">¶</a></h3>
<p>对于一个问题而言,我们有初始分布<img src="https://math.now.sh?inline=%5Cpi" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,转移概率矩阵A,在给定的任意一个时刻t,我们都能有一个状态<img src="https://math.now.sh?inline=q_t" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,时间的变化,随一个状态转移到另一个状态,便能得到一个观测序列,即为状态序列<img src="https://math.now.sh?inline=O%3D%5Bq_1%2Cq_2%2Cq_3%2Cq_4%2C...%2Cq_m%5D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.且整个问题中一共有n个观测状态.出现这样的序列的概率是:<img src="https://math.now.sh?inline=P%28O%7CA%2C%5Cpi%29%3DP(q_1)%5Cprod_%7Bt%3D2%7D%5EmP(q_t%7Cq_%7Bt-1%7D)" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,所以一个可观测的马尔可夫模型由一个三元组描述:<img src="https://math.now.sh?inline=%28A%2C%5Cpi%2Cn%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,一般情况下简记为<img src="https://math.now.sh?inline=%28A%2C%5Cpi%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.</p>
<p>如果穷举了所有的观测序列:</p>
<p><img src="https://math.now.sh?inline=%5Cpi_i%3D%5Cfrac%7B%E4%BB%A5%E7%8A%B6%E6%80%81i%E5%BC%80%E5%A7%8B%E7%9A%84%E5%BA%8F%E5%88%97%E7%9A%84%E6%95%B0%E7%9B%AE%7D%7B%E5%BA%8F%E5%88%97%E6%80%BB%E6%95%B0%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></p>
<p><img src="https://math.now.sh?inline=p_%7Bij%7D%3D%5Cfrac%7B%E4%BB%8E%E7%8A%B6%E6%80%81i%E8%BD%AC%E7%A7%BB%E5%88%B0%E7%8A%B6%E6%80%81j%E7%9A%84%E5%BA%8F%E5%88%97%E6%95%B0%E7%9B%AE%7D%7B%E4%BB%8E%E7%8A%B6%E6%80%81i%E5%BC%80%E5%A7%8B%E8%BD%AC%E7%A7%BB%E7%9A%84%E5%BA%8F%E5%88%97%E6%80%BB%E6%95%B0%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></p>
<h3 id="隐马尔可夫模型">隐马尔可夫模型<a class="anchor" href="#隐马尔可夫模型">¶</a></h3>
<h4 id="两个基本假设">两个基本假设<a class="anchor" href="#两个基本假设">¶</a></h4>
<ul>
<li>齐次马尔可夫性假设:<img src="https://math.now.sh?inline=P%28i_t%7Ci_%7Bt-1%7D%2Co_%7Bt-1%7D%2C...%2Ci_1%2Co_1%29%3DP(i_t%7Ci_%7Bt-1%7D)%2Ct%3D1%2C2%2C...%2CT" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.表示任意时刻t的状态只依赖前一时刻的状态,与其他状态和观测都无关.</li>
<li>观测独立性假设:<img src="https://math.now.sh?inline=P%28o_t%7Ci_T%2Co_T%2Ci_%7BT-1%7D%2Co_%7BT-1%7D%2C...%2Ci_%7Bt%2B1%7D%2Co_%7Bt%2B1%7D%2Ci_t%2Co_t%2Ci_%7Bt-1%7D%2Co_%7Bt-1%7D%2C...%2Ci_1%2Co_1%29%3DP(o_t%7Ci_t)" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.对于任意时刻的观测,只依赖该时刻的状态,与其他时刻的观测和状态都无关.</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@src/source/_posts/%E7%AE%97%E6%B3%95/%E4%B8%80%E4%BA%9B%E7%AE%97%E6%B3%95/%E9%9A%90%E9%A9%AC%E5%B0%94%E5%8F%AF%E5%A4%AB.png" alt="隐马尔可夫.png"></p>
<p><img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@src/source/_posts/%E7%AE%97%E6%B3%95/%E4%B8%80%E4%BA%9B%E7%AE%97%E6%B3%95/%E9%9A%90%E9%A9%AC%E5%B0%94%E5%8F%AF%E5%A4%AB_1.png" alt="隐马尔可夫_1.png"></p>
<h4 id="基本想法">基本想法<a class="anchor" href="#基本想法">¶</a></h4>
<p>系统的状态S无法预测,但是可以观测到某个其他和状态相关联的事物,这个事物出现是伴随系统状态而出现的.</p>
<h4 id="基本假设">基本假设<a class="anchor" href="#基本假设">¶</a></h4>
<p>观测概率不依赖时间(马尔可夫过程)</p>
<ul>
<li>观测集合：<img src="https://math.now.sh?inline=R%3D%5C%7BR_1%2CR_2%2CR_3%2CR_4%2C...%2CR_m%5C%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></li>
<li>观测序列：<img src="https://math.now.sh?inline=O%3D%5Bo_1%2Co_2%2Co_3%2Co_4%2C...%2Co_l%5D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></li>
<li>状态集合：<img src="https://math.now.sh?inline=S%3D%5C%7BS_1%2CS_2%2CS_3%2CS_4%2C..%2CS_n%5C%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></li>
<li>状态序列：<img src="https://math.now.sh?inline=Q%3D%5Bq_1%2Cq_2%2Cq_3%2Cq_4%2C...%2Cq_l%5D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></li>
<li>观测概率：<img src="https://math.now.sh?inline=P%5C%7Bo_i%3DR_k%7Cq_t%3DS_j%5C%7D%3Db_j%28i%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">，记<img src="https://math.now.sh?inline=B%3D%5Bb_j%28i%29%5D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,叫做发射概率矩阵</li>
<li>隐马尔可夫模型由一个五元组描述<img src="https://math.now.sh?inline=%28A%2CB%2C%5Cpi%2CR%2CS%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">，简记为<img src="https://math.now.sh?inline=%28A%2CB%2C%5Cpi%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.初始分布属于状态集合.</li>
</ul>
<h4 id="基本问题">基本问题<a class="anchor" href="#基本问题">¶</a></h4>
<ul>
<li>
<p><em>估计</em>:已知模型<img src="https://math.now.sh?inline=%28A%2CB%2C%5Cpi%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,求观测序列出现的概率</p>
<p>解决方法:前向后向算法</p>
</li>
<li>
<p><em>预测</em>:已知模型<img src="https://math.now.sh?inline=%28A%2CB%2C%5Cpi%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">和一个观测序列,求对应的不可观测的状态序列</p>
<p>解决方法:Viterbi算法</p>
</li>
<li>
<p><em>学习</em>:已知一组观测序列,求模型<img src="https://math.now.sh?inline=%28A%2CB%2C%5Cpi%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></p>
<p>解决方法:Baum-Welch算法</p>
</li>
</ul>
<h4 id="注意">注意<a class="anchor" href="#注意">¶</a></h4>
<ul>
<li>不同的状态序列可以产生相同的观测序列(以不同的概率产生)</li>
<li>状态转移是随机的,系统在一个状态中产生的观测也随机的</li>
<li>可观测的马尔可夫模型是特殊的隐马尔可夫模型</li>
</ul>
<h3 id="吸收马尔可夫链">吸收马尔可夫链<a class="anchor" href="#吸收马尔可夫链">¶</a></h3>
<p>在马尔可夫链中,称<img src="https://math.now.sh?inline=P_%7Bij%7D%3D1" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">的状态是吸收状态.如果一个马尔可夫链中至少包含一个吸收状态,并且从每一个非吸收状态出发,都能到达某个吸收状态,那么这个马尔科夫链称为吸收马尔可夫链.</p>
<p><img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@src/source/_posts/%E7%AE%97%E6%B3%95/%E4%B8%80%E4%BA%9B%E7%AE%97%E6%B3%95/%E5%90%B8%E6%94%B6%E9%A9%AC%E5%B0%94%E5%8F%AF%E5%A4%AB.png" alt="吸收马尔可夫.png"></p>
<p>对于吸收链P<em>的标准形式，矩阵I-Q具有可逆矩阵N，且<img src="https://math.now.sh?inline=N%3D%28I-Q%29%5E%7B-1%7D%3DI%2BQ%2BQ%5E2%2B%C2%B7%C2%B7%C2%B7" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">。N的元素nij是从非吸收状态<img src="https://math.now.sh?inline=s_i" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">到另一非吸收状态<img src="https://math.now.sh?inline=s_j" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">的平均转移次数。设c为元素全为1的列向量c=[1,1,···,1]'，则</em>t=Nc的第i个分量是从第i个非吸收态出发，到某个吸收状态的平均转移次数。从非吸收状态i出发终被吸收状态j吸收的概率由B=NR给出。</p>
<p>详细解释参考:https://www.cnblogs.com/guolei/p/3504931.html</p>
<h2 id="排队论">排队论<a class="anchor" href="#排队论">¶</a></h2>
<h3 id="符号表示">符号表示<a class="anchor" href="#符号表示">¶</a></h3>
<table>
<thead>
<tr>
<th style="text-align:center">符号</th>
<th style="text-align:center">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">X</td>
<td style="text-align:center">顾客到达流或者顾客到达间隔时间的分布</td>
</tr>
<tr>
<td style="text-align:center">Y</td>
<td style="text-align:center">服务时间的分布</td>
</tr>
<tr>
<td style="text-align:center">Z</td>
<td style="text-align:center">服务台数目</td>
</tr>
<tr>
<td style="text-align:center">A</td>
<td style="text-align:center">系统容量限制</td>
</tr>
<tr>
<td style="text-align:center">B</td>
<td style="text-align:center">顾客源数目</td>
</tr>
<tr>
<td style="text-align:center">C</td>
<td style="text-align:center">服务规则</td>
</tr>
</tbody>
</table>
<p>例如:银行服务系统为先到先服务,C即为FCFS.一般系统容量与顾客源数目均视为无限.指数分布具备无记忆性,即Markov性(M).在这个问题中服务台为1,问题就可以表述为M/M/1.</p>
<h3 id="运行指标">运行指标<a class="anchor" href="#运行指标">¶</a></h3>
<ul>
<li>平均队长<img src="https://math.now.sh?inline=L_s" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">:系统内顾客数的期望(可以理解为在处理的客户和还在等待中的客户)</li>
<li>平均排序长<img src="https://math.now.sh?inline=L_q" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">:系统内等待服务的顾客数的期望</li>
<li>平均逗留时间<img src="https://math.now.sh?inline=W_s" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">:顾客在系统内逗留时间的期望(可以理解为等待时间+处理时间)</li>
<li>平均等待时间<img src="https://math.now.sh?inline=W_q" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">:顾客在排队中等待时间的期望</li>
</ul>
<h3 id="记号">记号<a class="anchor" href="#记号">¶</a></h3>
<ul>
<li>N(t)表示在时间区间[0,t)内到达的顾客数(t&gt;0)</li>
<li><img src="https://math.now.sh?inline=P_n%28t_1%2Ct_2%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">表示在时间区间[<img src="https://math.now.sh?inline=t_1%2Ct_2" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">)内有n个顾客到达的概率.<img src="https://math.now.sh?inline=P_n%28t_1%2Ct_2%29%3DP%5C%7BN(t_1)-N(t2)%5C%7D%3Dn" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></li>
</ul>
<h3 id="输入过程">输入过程<a class="anchor" href="#输入过程">¶</a></h3>
<ol>
<li>
<p>在不重叠时间区内顾客到达数相互独立;</p>
</li>
<li>
<p>充分小的<img src="https://math.now.sh?inline=%5CDelta%20t" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">时间,在时间区间<img src="https://math.now.sh?inline=%5Bt%2Ct%2B%5CDelta%20t%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">内有一个顾客到达的概率与t无关,而大约和区间长<img src="https://math.now.sh?inline=%5CDelta%20t" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">成正比,即:<img src="https://math.now.sh?inline=P_1%28t%2Ct%2B%5CDelta%20t%29%3D%5Clambda%20%5CDelta%20t%2B%5Comicron(%5CDelta%20t)" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.用<img src="https://math.now.sh?inline=%5Clambda%20%3E0" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">表示单位时间内平均到达的顾客数</p>
</li>
<li>
<p>对于充分小的,在时间区间内有两个或两个以上顾客到达的概率极小,可以忽略,即<img src="https://math.now.sh?inline=%5Csum_%7Bn%3D2%7D%5E%5Cinfty%7BP_n%28t%2Ct%2B%5CDelta%20t%29%3D%5Comicron(%5CDelta%20t)%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></p>
<p>符合以上的条件即服从泊松分布.</p>
</li>
</ol>
<h3 id="服务过程">服务过程<a class="anchor" href="#服务过程">¶</a></h3>
<ol>
<li>充分小的<img src="https://math.now.sh?inline=%5CDelta%20t" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">时间,在时间区间<img src="https://math.now.sh?inline=%5Bt%2Ct%2B%5CDelta%20t%29" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">内有一个顾客服务完的概率与t无关,而 大概与去区间长<img src="https://math.now.sh?inline=%5CDelta%20t" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">成正比,即<img src="https://math.now.sh?inline=P%28T%5Cle%5CDelta%20t%29%3D%5Cmu%5CDelta%20t%2B%5Comicron(%5CDelta%20t)" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">,T为服务时间,用<img src="https://math.now.sh?inline=%5Cmu%3E0" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">表示单位时间内平均服务的顾客数.</li>
</ol>
<h2 id="最大熵">最大熵<a class="anchor" href="#最大熵">¶</a></h2>
<p>克劳德 艾尔伍德 香农在1948年提出信息熵,用来描述信息的不确定程度.</p>
<p>最大熵原理其实就是指包含已知信息(约束条件),不做任何未知假设,把未知事件当成等概率事件处理.</p>
<p>一个系统的信息熵其实是系统中的每一个事件的概率乘上log概率,然后将所有事件相加取复数.</p>
<p><img src="https://math.now.sh?inline=H%28P%29%3D-%5Csum_XP(X)logP(X)" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></p>
<table>
<thead>
<tr>
<th style="text-align:center">log底数的取值</th>
<th style="text-align:center">相应信息熵的单位取值</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">2</td>
<td style="text-align:center">比特(bit)</td>
</tr>
<tr>
<td style="text-align:center">e</td>
<td style="text-align:center">奈特(nat)</td>
</tr>
<tr>
<td style="text-align:center">10</td>
<td style="text-align:center">哈托特(hat)</td>
</tr>
</tbody>
</table>
<p>因为概率总是在0-1之间,log之后小于0,加上负号才是正数.</p>
<h2 id="任务调度算法">任务调度算法<a class="anchor" href="#任务调度算法">¶</a></h2>
<h3 id="Conservation-BackFilling算法">Conservation BackFilling算法<a class="anchor" href="#Conservation-BackFilling算法">¶</a></h3>
<p>在等待任务队列中选择任务进行回填，该任务必须保证不能使预约在其前面的任务延迟执行。步骤如下：</p>
<ol>
<li>寻找插入点
<ol>
<li>对当前虚拟机的时空分布图进行扫描，如果发现可以满足该任务申请的处理器资源的第一个时间点作为该任务的插入点。</li>
<li>从插入点开始，扫描时空图，确保当前任务在插入点后的执行时间处理器都是可用的。</li>
<li>若条件2不满足，则返回1继续执行扫描，直到找到一个合适的插入点。</li>
</ol>
</li>
<li>更新虚拟机的时空图，及时反馈当前任务的调度情况，将当前任务提交到插入点执行。</li>
</ol>
<h3 id="Easy-BackFilling算法">Easy BackFilling算法<a class="anchor" href="#Easy-BackFilling算法">¶</a></h3>
<p>该算法不需要考虑等待队列后面的任务对排在前面任务造成的延迟。回填时根据等待任务申请的处理器资源的大小尽可能提前将小任务回填至空闲资源中执行。在扫描虚拟机时空图前对所有的等待任务按照申请的处理器的资源大小升序排列，优先回填小任务。</p>
<h3 id="Improved-BackFilling算法">Improved BackFilling算法<a class="anchor" href="#Improved-BackFilling算法">¶</a></h3>
<p>使用Balanced Spiral方法对等待任务进行分类，按照任务所申请的PE的大小进行升序排列，排序处理提交任务所申请的处理器核心数将任务排成V字形的趋势进行排序，然后对后续提交的任务进行回填作业。</p>
<h2 id="Tip">Tip<a class="anchor" href="#Tip">¶</a></h2>
<h3 id="显著性水平">显著性水平<a class="anchor" href="#显著性水平">¶</a></h3>
<p>假设检验是围绕对原假设内容的审定而展开的。如果原假设正确我们接受了（同时也就拒绝了备择假设），或原假设错误我们拒绝了（同时也就接受了备择假设），这表明我们作出了正确的决定。但是，由于假设检验是根据样本提供的信息进行推断的，也就有犯错误的可能。<em>有这样一种情况，原假设正确，而我们却把它当成错误的加以拒绝。犯这种错误的概率用α表示，统计上把α称为假设检验中的显著性水平  ，也就是决策中所面临的风险。</em></p>
<h3 id="小概率原理">小概率原理<a class="anchor" href="#小概率原理">¶</a></h3>
<p>小概率原理是指一个事件的发生概率很小，那么它在一次试验中是几乎不可能发生的，但在多次重复试验中是必然发生的。统计学上，把小概率事件在一次实验中看成是实际不可能发生的事件，一般认为等于或小于0.05或0.01的概率为小概率。</p>
<h3 id="离散程度指标">离散程度指标<a class="anchor" href="#离散程度指标">¶</a></h3>
<p>离散指标的数据越小,说明数据的离散程度越小,反之亦然.</p>
<h4 id="全距-Range">全距(Range)<a class="anchor" href="#全距-Range">¶</a></h4>
<p>又称极差,指数据中最大值与最小值的差.即<img src="https://math.now.sh?inline=R%3Dmax-min" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.是一个比较粗糙的测度指标。如果需要全面、精确地说明数据离散程度时，就不宜使用全距.</p>
<h4 id="平均差-Mean-Absolute-Deviation">平均差(Mean Absolute Deviation)<a class="anchor" href="#平均差-Mean-Absolute-Deviation">¶</a></h4>
<p>各项数值与其均值绝对值之和的平均数,即<img src="https://math.now.sh?inline=MAD%3D%5Cfrac%7B%5Csum%7CX-%5Coverline%7BX%7D%7C%7D%7Bn%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;"></p>
<p>虽然平均差简单易懂，但因为使用了绝对值，不便于进一步计算，所以在实际应用中不如其他离散指标应用那样广泛。但在预测领域，还常常使用该指标用于误差的说明。</p>
<h4 id="方差-Variance">方差(Variance)<a class="anchor" href="#方差-Variance">¶</a></h4>
<p>指全部数据离差平方的平均数,即<img src="https://math.now.sh?inline=%5Csigma%5E2%3D%5Cfrac%7B%5Csum_%7Bi%3D1%7D%5En%28X_i-%5Cmu%29%5E2%7D%7Bn%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.</p>
<p>方差克服了平均差绝对值的问题，成为描述离散程度的一个重要指标。但是，在方差数值含义的解释上却遇到困难。因为方差的单位是数据单位的平方，夸大了数据的离散程度，使人不易直观理解数值意义.</p>
<h4 id="标准差-Standard-Deviation">标准差(Standard Deviation)<a class="anchor" href="#标准差-Standard-Deviation">¶</a></h4>
<p>通常取方差的算数平方根作为描述离散程度的指标,即<img src="https://math.now.sh?inline=%5Csigma%3D%5Csqrt%7B%5Cfrac%7B%5Csum_%7Bi%3D1%7D%5En%28X_i-%5Cmu%29%5E2%7D%7Bn%7D%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.</p>
<h4 id="样本的方差和标准差">样本的方差和标准差<a class="anchor" href="#样本的方差和标准差">¶</a></h4>
<p>分别用<img src="https://math.now.sh?inline=S%5E2%E5%92%8CS" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">表示.与总体的方差和标准差之间的唯一区别就是分数的分母是n-1,而不是n了.因为样本的方差和标准差在使用中，经常作为总体方差和标准差的估计量，如果直接除以样本容量n，得到的结果相对于总体方差和标准差来说是有偏的；除以自由度n-1可以得到总体方差和标准差的较好的估计量。</p>
<h4 id="离散系数-Coefficient-Of-Variation">离散系数(Coefficient Of Variation)<a class="anchor" href="#离散系数-Coefficient-Of-Variation">¶</a></h4>
<p>为标准差与均值的比值.一般用V表示.总体的离散系数<img src="https://math.now.sh?inline=V_%5Csigma%3D%5Cfrac%7B%5Csigma%7D%7B%5Cmu%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.样本的离散系数<img src="https://math.now.sh?inline=V_%5Csigma%3D%5Cfrac%7BS%7D%7B%5Coverline%20X%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.</p>
<h4 id="异众比率">异众比率<a class="anchor" href="#异众比率">¶</a></h4>
<p>异众比率指的是总体中非众数次数与总体全部次数之比，常常使用<img src="https://math.now.sh?inline=V_r" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">来表示.假设有N个样本值,样本存在一个众数c,且众数的个数为n,则异众比率<img src="https://math.now.sh?inline=V_r%3D%5Cfrac%7BN-n%7D%7BN%7D%3D1-%5Cfrac%7Bn%7D%7BN%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.</p>
<h4 id="四分位距-interquartile-range-IQR">四分位距(interquartile range, IQR)<a class="anchor" href="#四分位距-interquartile-range-IQR">¶</a></h4>
<p>又称四分差,以确定第三四分位数(上分位数)和第一二分位数(下分位数)的区别.<img src="https://math.now.sh?inline=IQR%3DQ_3-Q_1" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.用来画出箱线图查看数据的异常点,数据的偏态和数据的大致形状.</p>
<h3 id="四分位数">四分位数<a class="anchor" href="#四分位数">¶</a></h3>
<ul>
<li>第一四分位数<img src="https://math.now.sh?inline=Q_1" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">，又称较小四分位数，等于该样本中所有数值由小到大排列后第25%的数字。</li>
<li>第二四分位数<img src="https://math.now.sh?inline=Q_2" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">，又称中位数，等于该样本中所有数值由小到大排列后第50%的数字。</li>
<li>第三四分位数<img src="https://math.now.sh?inline=Q_3" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">，又称较大四分位数，等于该样本中所有数值由小到大排列后第75%的数字。</li>
</ul>
<p>主要选择四分位的百分比值p，及样本总量n.有以下数学公式可以表示：</p>
<ul>
<li>
<p>情况1：如果L是一个整数，则取第L和第L+1的平均值.</p>
</li>
<li>
<p>情况2：如果L不是一个整数，则取向下取整.</p>
</li>
</ul>
<h4 id="四分位差-QD">四分位差(QD)<a class="anchor" href="#四分位差-QD">¶</a></h4>
<p><img src="https://math.now.sh?inline=QD%3D%5Cfrac%7BQ_3-Q_1%7D%7B2%7D" style="filter: opacity(95%);transform:scale(0.85);text-align:center;display:inline-block;margin: 0;">.</p>

                
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/about" rel="external nofollow noreferrer">不二</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="http://buerlog.top/2020/05/14/suan-fa/yi-xie-suan-fa/">http://buerlog.top/2020/05/14/suan-fa/yi-xie-suan-fa/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/about" target="_blank">不二</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/%E9%A9%AC%E5%B0%94%E5%8F%AF%E5%A4%AB/">
                                    <span class="chip bg-color">马尔可夫</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/medias/reward/wechat.png" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>

            
        </div>
    </div>

    

    

    

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/2020/08/13/cheng-xu-she-ji/java/spring-shi-zhan-xue-xi/">
                    <div class="card-image">
                        
                        <img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@src/source/_posts/PageImg/程序设计/spring.png" class="responsive-img" alt="Spring实战学习">
                        
                        <span class="card-title">Spring实战学习</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2020-08-13
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1/" class="post-category">
                                    程序设计
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/Java/">
                        <span class="chip bg-color">Java</span>
                    </a>
                    
                    <a href="/tags/Spring/">
                        <span class="chip bg-color">Spring</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2020/04/15/suan-fa/acwing-xue-xi/">
                    <div class="card-image">
                        
                        <img src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@src/source/_posts/PageImg/算法/algorithm1.jpeg" class="responsive-img" alt="Acwing学习">
                        
                        <span class="card-title">Acwing学习</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-04-15
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/%E7%AE%97%E6%B3%95/" class="post-category">
                                    算法
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/Cpp/">
                        <span class="chip bg-color">Cpp</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>


<script>
    $('#articleContent').on('copy', function (e) {
        // IE8 or earlier browser is 'undefined'
        if (typeof window.getSelection === 'undefined') return;

        var selection = window.getSelection();
        // if the selection is short let's not annoy our users.
        if (('' + selection).length < Number.parseInt('120')) {
            return;
        }

        // create a div outside of the visible area and fill it with the selected text.
        var bodyElement = document.getElementsByTagName('body')[0];
        var newdiv = document.createElement('div');
        newdiv.style.position = 'absolute';
        newdiv.style.left = '-99999px';
        bodyElement.appendChild(newdiv);
        newdiv.appendChild(selection.getRangeAt(0).cloneContents());

        // we need a <pre> tag workaround.
        // otherwise the text inside "pre" loses all the line breaks!
        if (selection.getRangeAt(0).commonAncestorContainer.nodeName === 'PRE') {
            newdiv.innerHTML = "<pre>" + newdiv.innerHTML + "</pre>";
        }

        var url = document.location.href;
        newdiv.innerHTML += '<br />'
            + '来源: 不二博客<br />'
            + '文章作者: 不二<br />'
            + '文章链接: <a href="' + url + '">' + url + '</a><br />'
            + '本文章著作权归作者所有，任何形式的转载都请注明出处。';

        selection.selectAllChildren(newdiv);
        window.setTimeout(function () {bodyElement.removeChild(newdiv);}, 200);
    });
</script>


<!-- 代码块功能依赖 -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/codeBlock/codeShrink.js"></script>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget card" style="background-color: white;">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4, h5, h6'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4, h5, h6').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/aplayer/APlayer.min.css">
<style>
    .aplayer .aplayer-lrc p {
        
        display: none;
        
        font-size: 12px;
        font-weight: 700;
        line-height: 16px !important;
    }

    .aplayer .aplayer-lrc p.aplayer-lrc-current {
        
        display: none;
        
        font-size: 15px;
        color: #42b983;
    }

    
    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
        left: -66px !important;
    }

    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
        left: 0px !important;
    }

    
</style>
<div class="">
    
    <div class="row">
        <meting-js class="col l8 offset-l2 m10 offset-m1 s12"
                   server="netease"
                   type="song"
                   id="1901371647"
                   fixed='true'
                   autoplay='false'
                   theme='#42b983'
                   loop='all'
                   order='random'
                   preload='auto'
                   volume='0.7'
                   list-folded='true'
        >
        </meting-js>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/aplayer/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>

    
    <div class="container row center-align" style="margin-bottom: 15px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            
                <span id="year">2018-2023</span>
            
            <span id="year">2018</span>
            <a href="/about" target="_blank">不二</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                class="white-color">263.4k</span>&nbsp;字
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <span id="sitetime">载入运行时间...</span>
            <script>
                function siteTime() {
                    var seconds = 1000;
                    var minutes = seconds * 60;
                    var hours = minutes * 60;
                    var days = hours * 24;
                    var years = days * 365;
                    var today = new Date();
                    var startYear = "2018";
                    var startMonth = "5";
                    var startDate = "25";
                    var startHour = "17";
                    var startMinute = "20";
                    var startSecond = "53";
                    var todayYear = today.getFullYear();
                    var todayMonth = today.getMonth() + 1;
                    var todayDate = today.getDate();
                    var todayHour = today.getHours();
                    var todayMinute = today.getMinutes();
                    var todaySecond = today.getSeconds();
                    var t1 = Date.UTC(startYear, startMonth, startDate, startHour, startMinute, startSecond);
                    var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
                    var diff = t2 - t1;
                    var diffYears = Math.floor(diff / years);
                    var diffDays = Math.floor((diff / days) - diffYears * 365);
                    var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours);
                    var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) /
                        minutes);
                    var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours -
                        diffMinutes * minutes) / seconds);
                    if (startYear == todayYear) {
                        document.getElementById("year").innerHTML = todayYear;
                        document.getElementById("sitetime").innerHTML = "本站已安全运行 " + diffDays + " 天 " + diffHours +
                            " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                    } else {
                        document.getElementById("year").innerHTML = startYear + " - " + todayYear;
                        document.getElementById("sitetime").innerHTML = "本站已安全运行 " + diffYears + " 年 " + diffDays +
                            " 天 " + diffHours + " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                    }
                }
                setInterval(siteTime, 1000);
            </script>
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/weiyouwozuiku" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:weiyouwozuiku@gmail.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1104891151" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1104891151" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>





    <a href="https://www.zhihu.com/people/he-he-9-35-47" class="tooltipped" target="_blank" data-tooltip="关注我的知乎: https://www.zhihu.com/people/he-he-9-35-47" data-position="top" data-delay="50">
        <i class="fab fa-zhihu1">知</i>
    </a>



    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>

    <script src='https://unpkg.com/mermaid@8.14.0/dist/mermaid.min.js'></script>
    <script>
      if (window.mermaid) {
        mermaid.initialize({theme: 'forest'});
      }
    </script>
  

    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script type="text/javascript">
$(function () {
    var searchFunc = function (path, search_id, content_id) {
        'use strict';
        $.ajax({
            url: path,
            dataType: "xml",
            success: function (xmlResponse) {
                // get the contents from search data
                var datas = $("entry", xmlResponse).map(function () {
                    return {
                        title: $("title", this).text(),
                        content: $("content", this).text(),
                        url: $("url", this).text()
                    };
                }).get();
                var $input = document.getElementById(search_id);
                var $resultContent = document.getElementById(content_id);
                $input.addEventListener('input', function () {
                    var str = '<ul class=\"search-result-list\">';
                    var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                    $resultContent.innerHTML = "";
                    if (this.value.trim().length <= 0) {
                        return;
                    }
                    // perform local searching
                    datas.forEach(function (data) {
                        var isMatch = true;
                        var data_title = data.title.trim().toLowerCase();
                        var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                        var data_url = data.url;
                        data_url = data_url.indexOf('/') === 0 ? data.url : '/' + data_url;
                        var index_title = -1;
                        var index_content = -1;
                        var first_occur = -1;
                        // only match artiles with not empty titles and contents
                        if (data_title !== '' && data_content !== '') {
                            keywords.forEach(function (keyword, i) {
                                index_title = data_title.indexOf(keyword);
                                index_content = data_content.indexOf(keyword);
                                if (index_title < 0 && index_content < 0) {
                                    isMatch = false;
                                } else {
                                    if (index_content < 0) {
                                        index_content = 0;
                                    }
                                    if (i === 0) {
                                        first_occur = index_content;
                                    }
                                }
                            });
                        }
                        // show search results
                        if (isMatch) {
                            str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                            var content = data.content.trim().replace(/<[^>]+>/g, "");
                            if (first_occur >= 0) {
                                // cut out 100 characters
                                var start = first_occur - 20;
                                var end = first_occur + 80;
                                if (start < 0) {
                                    start = 0;
                                }
                                if (start === 0) {
                                    end = 100;
                                }
                                if (end > content.length) {
                                    end = content.length;
                                }
                                var match_content = content.substr(start, end);
                                // highlight all keywords
                                keywords.forEach(function (keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>");
                                });

                                str += "<p class=\"search-result\">" + match_content + "...</p>"
                            }
                            str += "</li>";
                        }
                    });
                    str += "</ul>";
                    $resultContent.innerHTML = str;
                });
            }
        });
    };

    searchFunc('/search.xml', 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/materialize/materialize.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/aos/aos.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/js/matery.js"></script>

    <!-- Baidu Analytics -->

<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?943a68f473d421f2d98228f74edc63d0";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    
    <script async src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    <!--腾讯兔小巢-->
    
    
    <script type="text/javascript" color="0,0,255"
        pointColor="0,0,255" opacity='0.7'
        zIndex="-1" count="150"
        src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/background/canvas-nest.js"></script>
    

    
    
    <script type="text/javascript" size="150" alpha='0.6'
        zIndex="-1" src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/background/ribbon-refresh.min.js" async="async"></script>
    

    
    <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/background/ribbon-dynamic.js" async="async"></script>
    

    
    <script src="https://cdn.jsdelivr.net/gh/weiyouwozuiku/weiyouwozuiku.github.io@master/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
